package com.oa.hyperion.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oa.hyperion.entity.assets.AssetsRepair;
import com.oa.hyperion.entity.assets.AssetsScrap;
import com.oa.hyperion.repository.assets.AssetsScrapMapper;
import com.oa.hyperion.service.AssetsScrapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AssetsScrapServiceImpl implements AssetsScrapService {
    @Autowired
    private AssetsScrapMapper assetsScrapMapper;


    @Override
    public void insert(AssetsScrap assetsScrap) {
        assetsScrapMapper.insert(assetsScrap);
    }

    @Override
    public List<AssetsScrap> getAssetsScrapInfo() {
        return assetsScrapMapper.getAssetsScrapInfo();
    }

    @Override
    public AssetsScrap getAssetsScrapByAssetId(int asset_id) {
        return assetsScrapMapper.getAssetsScrapByAssetId(asset_id);
    }

    @Override
    public List<AssetsScrap> getAssetsScrapByHandler(String handler) {
        return assetsScrapMapper.getAssetsScrapByHandler(handler);
    }

    @Override
    public PageInfo<AssetsScrap> getByCondition(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<AssetsScrap> assetsScraps = assetsScrapMapper.getAssetsScrapInfo();
        return new PageInfo<>(assetsScraps);
    }
}
